
#include <stdlib.h>
#include "dll.h"

void		dll_del(t_dll **node)
{
  t_dll		*p_node;
  t_dll		*n_node;
  t_dll		*c_node;

  c_node = *node;
  n_node = c_node->next;
  p_node = c_node->prev;
  if (p_node != NULL)
    p_node->next = n_node;
  if (n_node != NULL)
    n_node->prev = p_node;
  // free data here
  free(c_node);
  if (n_node != NULL)
    *node = n_node;
  else if (p_node != NULL)
    *node = p_node;
  else
    *node = NULL;
}
